Direct URL calls to run one-off reports

Content Management also supports direct calls to its reports from your web page code, so that you can create one-off reports you may need. This sample code for a Print Detail button on the Batch details page shows the process:

1.  Call a content item (@/iMIS/Accounting/BatchDetailReport).

2.  Pass it a parameter (Batch Number) as a URL parameter.

protected void PrintDetailClick(object sender, EventArgs e)

{

   Guid documentKey = DocumentSystem.DocumentKeyByPath("@/iMIS/Accounting/BatchDetailReport");

 

   Document d = DocumentController.Document(documentKey);

 

   Business.ContentManagement.Content content = Business.ContentManagement.Content.GetFromDocument(d);

 

   string url = string.Format(CultureInfo.InvariantCulture, "{0}?&Batch Number={1}", content.GetNavigateUrl(), Batch.BatchNumber);

 

   Response.Redirect(url);

}